/**
 * Created by mango on 2017/3/3.
 */
module.exports = {
    key: "response-describe",
    desc: "响应",
    create: function (content) {
        var list = [
            this.head(),
            content[this.key] ? this.content(content[this.key]) : ""
        ];
        return list.join("\r\n\r\n");
    },
    head: function () {
        return "**" + this.desc + "参数：**";
    },
    content: function (content) {
        var list = [this.tableHead()];
        for (var i = 0; i < content.length; i++) {
            list.push(this.setBody(content[i]));
        }
        return list.join("\r\n");
    },
    tableHead: function () {
        return "|参数名|必选|类型|说明|\n|:----    |:---|:----- |-----   |";
    }, setBody: function (item) {
        return ("|" + item.title + " |" + (item.isNull ? "否" : "是" ) + "  |" + item.dataType + " |" + item.describe + "   |");
    }
}